<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>客户员工访谈记录列表</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
  <div class="pageIn2layout">
  
	<jsp:include page="../../project/prjbscinfo/prjGuarInvestRpt.jsp" flush="true" >
		<jsp:param name="currentNav" value="prjCorpGuarEmpIntvRec"/>
	</jsp:include>
<div class="pageIn2L_mid">
<div class="searchArea">
           <div class="clearFix"></div>
            <div class="btnsBox">
              <span id="addBtn" onclick="addBtn();" class="sq-button sq-button-round">新增</span>
        <!--       <span id="removeBtn" onclick="removeBtn();" class="sq-button sq-button-round">作废</span> -->
           <!--     <span id="modifyBtn" onclick="modifyBtn();" class="sq-button sq-button-hasicon"><i class="sqBtnIco_4"></i>修改</span>
              <span id="detailBtn" onclick="detailBtn();" class="sq-button sq-button-hasicon"><i class="sqBtnIco_2"></i>详细</span> -->
            </div>
</div>
<div id="ligergrid1" class="sq-grid"></div>
</div>
</div>
</div>

<script type="text/javascript">
	var grid = null;
	var prjId = '${prjId}';
	var cstId = '${cstId}';
	var cstType ='${cstType}';
	var detailFlag ='${detailFlag}';
	var cstRlCd = '${cstRlCd}';
	$(function () {
		//自然人
	    var params = {};
		params.prjId = prjId;
		params.cstId = cstId;
		params.cstRlCd = cstRlCd;
		if(cstType==ProjectConstant.CST_TYP_CD_NP){
			 $("#ligergrid1").ligerGrid({
			    	url: '<%=path%>/project/prjcstempintvrec/initList.do',
			    	method : 'get',
			    	parms:params,
			        columns: [
			            { display: '姓名', name: 'nm', minWidth: 100 },
			            { display: '联系方式', name: 'tel',minWidth: 150},
			           { display: '与申请人关系', name: 'assRlCdNm', minWidth: 140 , enabledSort:true},
			            { display: '访谈记录', name: 'commRec', minWidth: 276},
			            {
			                display: '操作',
			                isSort: false,
			                width: 150,
			                render: function (rowdata, rowindex, value){
			                	 var h="";
			                	 if(detailFlag!="true"){
			                        h+='<a class="sq-button-hasicon" href="javascript:modifyBtn(';
			                        h+="'"+rowdata.id+"'";
			                        h+=')"><i class="sqBtnIco_4"></i>修改</a>';
			                        h+='<a class="sq-button-hasicon" href="javascript:removeBtn(';
			                        h+="'"+rowdata.id+"'";
			                        h+=')"><i class="sqBtnIco_7"></i>删除</a>';
			                        
			               		 }
			                        h+='<a class="sq-button-hasicon" href="javascript:detailBtn(';
			                        h+="'"+rowdata.id+"'";
			                        h+=')"><i class="sqBtnIco_2"></i>详细</a>'
			                    return h;
			                }
			            }
			        ],
			        pageSize:100,
			        root:'rows',
			        record:'total',
			        hideLoadButton : true,
			        width: '100%',
			        height:'100%',
			        heightDiff:-2,
			        //isScroll: false,
			        checkbox:true,
			        rownumbers:true,
			        usePagerOnLessPagesize: false,
			    });
		}
		if(cstType==ProjectConstant.CST_TYP_CD_LP){
			 $("#ligergrid1").ligerGrid({
			    	url: '<%=path%>/project/prjcstempintvrec/initList.do',
			    	method : 'get',
			    	parms:params,
			        columns: [
			            { display: '姓名', name: 'nm', minWidth: 100 },
			            { display: '联系方式', name: 'tel',minWidth: 150},
			            { display: '职务', name: 'posCd', minWidth: 60},
			            { display: '访谈记录', name: 'commRec', minWidth:276},
			            {
			                display: '操作',
			                isSort: false,
			                width: 200,
			                render: function (rowdata, rowindex, value){
			                	 var h="";
			                	 if(detailFlag!="true"){
			                        h+='<a class="sq-button-hasicon" href="javascript:modifyBtn(';
			                        h+="'"+rowdata.id+"'";
			                        h+=')"><i class="sqBtnIco_4"></i>修改</a>';
			                        
			                        h+='<a class="sq-button-hasicon" href="javascript:removeBtn(';
			                        h+="'"+rowdata.id+"'";
			                        h+=')"><i class="sqBtnIco_7"></i>删除</a>';
			               		 }
			                        h+='<a class="sq-button-hasicon" href="javascript:detailBtn(';
			                        h+="'"+rowdata.id+"'";
			                        h+=')"><i class="sqBtnIco_2"></i>详细</a>'
			                        	
			                    return h;
			                }
			            }
			        ],
			        pageSize:10,
			        root:'rows',
			        record:'total',
			        hideLoadButton : true,
			        width: '100%',
			        height:'100%',
			        heightDiff:-2,
			        //isScroll: false,
			        checkbox:true,
			        rownumbers:true,
			        usePager :false
			    });
		}
	   
	    grid = liger.get("ligergrid1");
	    if(detailFlag=="true"){
	    	$("#addBtn").hide();
	    //	$("#removeBtn").hide();
	    }
	});
	
	//客户员工访谈记录详情
	function detailBtn(id){
	        $.ligerDialog.open({title: '客户员工访谈记录详情',height: 250,width: 750, url: '<%=path%>/project/prjcstempintvrec/toGuarDetailPage.do?id='+id+'&&cstType='+cstType, isResize: true });
	}
	//添加客户员工访谈记录
	function addBtn(){
		var callback = function(){
			 grid.reload();
		}
        $.ligerDialog.open({title: '添加客户员工访谈记录',height: 250,width: 750, url: '<%=path%>/project/prjcstempintvrec/toGuarAddPage.do?prjId='+prjId+'&&cstId='+cstId+'&&cstType='+cstType+'&&cstRlCd='+cstRlCd, isResize: true });
	}
	//修改客户员工访谈记录
	function modifyBtn(id){
        $.ligerDialog.open({title: '修改客户员工访谈记录',height: 250,width: 750, url: '<%=path%>/project/prjcstempintvrec/toGuarAddPage.do?id='+id+'&&prjId='+prjId+'&&cstId='+cstId+'&&cstType='+cstType+'&&cstRlCd='+cstRlCd, isResize: true });
	}
	
	//删除修改客户员工访谈记录
	function removeBtn(id){
		/* var selectedRows = grid.getSelectedRows();
		if(selectedRows.length <1){
			$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warring"});
			return;
		} */
		var _ids = [];
		_ids.push(id);
		/* for ( var index in selectedRows) {
			_ids.push(selectedRows[index].id);
		} */
		$.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
			if(flag == false)return;
			$.ajax({
				type: 'post',
				dataType:'json',
				data:{ids:JSON.stringify(_ids)},
				url: '<%=path%>/project/prjcstempintvrec/removeByIds.do',
				success:function(msg){
					 if(msg.success == 1){
						 grid.reload();
					 }else{
						 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
					 }
				}
			});
		});
	}
	
	
	  
</script>

</body>
</html>